#ifndef _LIB_GLES_RENDER_H
#define _LIB_GLES_RENDER_H
#include <stdint.h>

struct gles_window_t;
struct gles_render_t;
struct gles_texture_t;

#ifdef _WIN32
typedef void* native_window_t;
#else 
typedef int native_window_t
#endif

enum GlesPixelFormat
{
    GLES_FORMAT_NONE,
	GLES_FORMAT_RGB24
};

struct gles_rect_t
{
	int x, y, w, h;
};

gles_window_t* gles_window_create(native_window_t native_window);
int gles_window_destroy(gles_window_t* esWindow);

gles_render_t* gles_render_create(gles_window_t* esWindow);
int gles_render_destroy(gles_render_t* esRender);
int gles_render_set_clear_color(gles_render_t* esRender,uint8_t r, uint8_t g, uint8_t b, uint8_t a);
int gles_render_clear(gles_render_t* esRender);

gles_texture_t* gles_texture_create(gles_render_t* render, GlesPixelFormat format, int width, int height);
int gles_texture_destroy(gles_texture_t* esTexture);
int gles_texture_update(gles_texture_t* dstTexture, const gles_rect_t* dstRect, const uint8_t* pixel, int pitch);

int gles_render_copy(gles_render_t* dstRender, gles_texture_t* srcTexture, const gles_rect_t* dstRect, const gles_rect_t* srcRect);

int gles_render_present(gles_render_t* esRender);


#endif
